perf(extensions): prune fired one-shot timers#565
Closed
JustYannicc wants to merge 71 commits into
Closed
Conversation
(cherry picked from commit fb7405f)
(cherry picked from commit 290a0f5)
(cherry picked from commit 3739cb0)
(cherry picked from commit c78d0b9)
…ated-integration-stack
…ated-integration-stack # Conflicts: # src/renderer/src/raycast-api/hooks/use-cached-promise.ts
…ated-integration-stack
…ated-integration-stack # Conflicts: # src/renderer/src/raycast-api/list-runtime-renderers.tsx # src/renderer/src/raycast-api/list-runtime.tsx
…ated-integration-stack # Conflicts: # src/renderer/src/CameraExtension.tsx
…ated-integration-stack
…ated-integration-stack # Conflicts: # src/renderer/src/raycast-api/list-runtime.tsx
…ated-integration-stack
…ated-integration-stack
… into codex/perf-consolidated-integration-stack
Collaborator
Author
|
Superseded by consolidated lifecycle/media wave-2 PR: #575 |
Collaborator
Author
|
Closing as superseded by #575. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Wrapped extension-scoped one-shot
setTimeoutandrequestAnimationFramecallbacks so fired handles remove themselves from the lifecycle registry and clearer maps. Extended the lifecycle sandbox harness with a flushable fake clock, explicit clear/cancel coverage, thrown-callback coverage, unmount cleanup coverage, and interval-retention assertions.Why
Long-lived menu-bar extensions can schedule repeated one-shot timers over hours. Those fired handles no longer need lifecycle cleanup, but they previously stayed in
registry.timeoutsandregistry.rafs, growing memory and future cleanup work until unmount or re-evaluation.Compatibility impact
No extension API shape changes. Timeout callback arguments and practical browser
thisbinding are preserved through the wrapper, explicitclearTimeoutandcancelAnimationFramestill untrack and cancel pending handles,setImmediatecontinues to delegate through timeout cleanup, and unmount cleanup still clears pending one-shots. Interval behavior remains explicit-clear/unmount based and intervals stay tracked until cleared.How tested
node --test scripts/test-extension-lifecycle-sandbox.mjs-> 8/8 passingnode --test 'scripts/test-*.mjs'-> 242/242 passingdiagnosticswithseverity: erroronsrc/renderer/src/ExtensionView.tsx-> no diagnosticsPerformance evidence
1000 fired timeouts: before stale registry entries=1000, after=01000 fired RAFs: before stale registry entries=1000, after=0Stack validation
Implementation branch was created from
fork/codex/perf-consolidated-integration-stackafter verifying bothHEADand that stack branch resolved to integration base264fb89dc5c867d6c3d77bc4b95e26e235e326ea.Replaces
None